package com.enjoyor.soa.traffic.util.mina;
import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolEncoder;
import org.apache.mina.filter.codec.ProtocolEncoderOutput;

public class CharsetEncoder implements ProtocolEncoder {
	public CharsetEncoder() {
	}

	public void dispose(IoSession session) throws Exception {
		System.out.println("#############dispose############");
	}

	public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception {
		System.out.println("#############字符编码2############");
		IoBuffer buff = IoBuffer.allocate(100).setAutoExpand(true);
		buff.put((byte[])message);
		buff.flip();
		out.write(buff);
	}
}
